<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="css/login.css" />
<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="js/login.js"></script>
<title>注册</title>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript">
   $(document).ready(function () {
      /**
       * 输入好注册信息，单击注册，提示注册成功，则进入首页
       */
      $("#zhuce").click(function () {
         var zhanghao=$("[name='zhanghao']").val();
         var mima=$("[name='mima']").val();

         var reg=/^[A-Za-z\d]{6,20}$/;

         if (reg.test(mima)){
            $.get("User/selectphone",{"phone":zhanghao,"password":mima},function (obj) {
               var rs=obj.status;

               if (rs==400){
                  alert("手机号已存在，无需注册");
               }else{
                  alert("注册成功");
                  add();
                  window.location.href="login.html";
               }
            });
         }else{
            alert("密码长度不符！！！重新输入");
         }


      });
      /**
       * 在注册页面也有一个登录按钮，但它不是在首页，是另一个登陆页面，单击”立即登录“跳转
       */
      $("#loginnow").click(function () {
         window.location.href="login.html";
      });
      /**
       * 由于未登录，无法保存简历，所以提示先登录。
       */
      $("#jianli").click(function () {
         alert("请先登录");
      });
   });
   function add() {
      $(document).ready(function () {
         var zhanghao=$("[name='zhanghao']").val();
         var mima=$("[name='mima']").val();
         $.get("User/add",{"phone":zhanghao,"password":mima},function () {

         });
      });

   }
</script>
</head>

<body>
<div class="header">
   <div class="mainwarp">
      <div class="logo"><a href="index.html"><img src="images/log.png" /></a></div>
      <div class="welcome">欢迎注册</div>
      <div class="headerright">
         <a href="login.html">个人登录</a>
         <span>|</span>
         <a href="index.html">返回首页</a>
      </div>
   </div>
</div>
<div class="zhuceBox">
   <div class="zcLeft">
      <ul id="tabzc">
          <li>邮箱/手机号注册</li>
          <li></li>
          <div class="clear"></div>
      </ul>
      <div class="clear"></div>
      <div id="contentzc">
          <ul style="display:block;">
             <div class="zcpart0">
                <div class="zcpart5">
                   <span></span>
                   <input name="zhanghao" type="text" placeholder="手机号"/>
                </div>
                <div class="zcpart6">手机号用于登录和找回密码</div>
                <div class="zcpart7">
                   <span></span>
                   <input name="mima" type="text" placeholder="设置密码"/>
                </div>
                <div class="zcpart6">请输入6-20个字符</div>
                <div class="zcpart2_c">
                    <span class="CheckBox Yes"></span>
                    <span style="float:left">我已阅读并接受<a href="user_agreement.html">用户协议</a></span>
                </div>
                <div class="clear"></div>
                <div  class="zcpart8">
                    <a id="zhuce">注 册</a>
                </div>
                <div class="zcpart8 zcpart9">
                    <a id="jianli">一分钟填写简历 快速填写 省时省力</a>
                </div>
             </div>
          </ul>
      </div>
   </div>
   <div class="zcRight">
      <div class="topdiv">
         <span class="noPa">已有账号了？</span><br />
         <a id="loginnow">立即登录</a>
      </div>
   </div>
</div>
<div class="clear"></div>
</body>
</html>
